<?php

require_once 'common/conn.php';
if (isset($_GET['start'])) {
    $num = $_GET['start'];
} else {
    $num = 0;
}
if (isset($_GET['limit'])) {
    $count = $_GET['limit'];
}

if (isset($_GET['usercode'])) {
    $usercode = $_GET['usercode'];
}

$data = array();
if (is_numeric($num) && is_numeric($count)) {
    $db = new DBC();
    $sql = "SELECT usercode,flashcode,type,downloadTime FROM t_device_product  WHERE usercode = '" . $usercode . "'  LIMIT " . $num . "," . $count;
    $temp = $db->fetchData($sql);
    if ($temp != false) {
        foreach ($temp as $row) {
            if ($row['downloadTime'] != null && $row['downloadTime'] != "null" && $row['downloadTime'] != "") {
                $row['isdownload'] = "1";
            } else {
                $row['isdownload'] = "0";
                array_push($data, $row);
            }
        }
    }
}
echo json_encode($data);
?>